Image processing apparatus, control method therefor, and storage medium

ABSTRACT

An image processing apparatus that enables a demosaicing process to be accurately carried out on a color image signal. With respect to a color mosaic image signal related to each pixel generated by photoelectrical conversion of an optical image reflecting a subject image, an interpolation process is carried out in which signals of missing colors in the each pixel are interpolated using image signals related to pixels in predetermined directions around the each pixel. The interpolation process is carried out in each of a plurality of predetermined directions. Color image signals in the predetermined directions subjected to the interpolation process are evaluated, and based on an evaluation result, a color image signal to be outputted as an interpolation process result is generated. The color image signals in the respective predetermined directions subjected to the interpolation process are evaluated with respect to homogeneity and signal intensity.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a divisional of application Ser. No. 12/760,209, filed Apr. 14, 2010, the entire disclosures of which are hereby incorporated by reference.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to an image processing apparatus, and in particular to an image processing apparatus and a control method therefor that carry out demosaicing by interpolating missing color signals for each pixel in a color image signal, as well as a computer-readable storage medium storing a program for causing a computer to execute the method.

2. Description of the Related Art

Conventionally, in a color image sensor, color filters in a Bayer pattern as shown in FIG. 19 are used. As the color filters, filters of three primary colors, i.e. red, green, and blue, or three complementary colors, i.e. cyan, magenta, and yellow are used.

In the Bayer pattern, however, only a color signal of one color can be obtained in each pixel, and hence a process is carried out in which color signals of the other two colors missing in each pixel are demosaiced (interpolated). As the demosaicing method, a number of methods have been conventionally known, and bi-linear interpolation and bi-cubic interpolation are known as basic demosaicing methods.

The bi-linear interpolation and the bi-cubic interpolation can obtain favorable interpolation results in, for example, an image including a number of low-frequency components, but causes false color called moiré, which does not exist in a real subject, to appear in an image including a number of high-frequency components. The false color results from demosaicing using pixels in a direction other than the direction of an edge which a subject image originally has.

Thus, there has been proposed a demosaicing method using pixels along the direction of an edge which a subject image originally has. This demosaicing method using pixels along the direction of an edge can be broadly divided into two methods. In Japanese Laid-Open Patent Publication (Kokai) No. 2002-300590, there has been proposed a method in which the direction of an edge is determined using neighboring pixels, and interpolation is carried out along the edge without carrying out interpolation in such a direction as to cross the edge.

Also, in Japanese Laid-Open Patent Publication (Kokai) No. 2002-300590, there has been proposed a method in which saturations are calculated using a pixel targeted for interpolation and its neighboring pixels, and a direction in which the saturation is small is adaptively selected so as to improve an accuracy of edge direction determination. On the other hand, in Japanese Laid-Open Patent Publication (Kokai) No. 2008-035470, there has been proposed a method in which interpolation is carried out first on a direction-by-direction basis to generate a plurality of kinds of interpolation results, and then a direction in which an appropriate interpolation result has been obtained is determined and selected.

In Japanese Laid-Open Patent Publication (Kokai) No. 2008-035470, there has been proposed an interpolation method in which an evaluation value called peripheral similarity indicative of the homogeneity of a pixel targeted for interpolation and its neighboring pixels is introduced for the determination about the appropriateness of an interpolating direction, and a direction in which the homogeneity is high is selected as an edge direction.

However, according to the method disclosed in Japanese Laid-Open Patent Publication (Kokai) No. 2002-300590, although false colors in a gray-scale subject having high-frequency components can be reduced, there is concern that an interpolation error resulting from an erroneous judgment occurs in a case of a subject having high-frequency components whose base is colored.

On the other hand, according to the method disclosed in Japanese Laid-Open Patent Publication (Kokai) No. 2008-035470, there may be a case where a false color with low-frequency components having high homogeneity is selected by mistake.

SUMMARY OF THE INVENTION

The present invention provides an image processing apparatus and a control method therefor that enable a demosaicing process to be accurately carried out on a color image signal, as well as a computer-readable storage medium storing a program for implementing the method.

Accordingly, in a first aspect of the present invention, there is provided an image processing apparatus comprising an interpolation unit adapted to carry out an interpolation process in which, with respect to a color mosaic image signal related to each pixel generated by photoelectrical conversion of an optical image reflecting a subject image, signals of missing colors in the each pixel are interpolated using image signals related to pixels in predetermined directions around the each pixel, wherein the interpolation unit comprises a direction-by-direction interpolation unit that carries out the interpolation process in each of a plurality of predetermined directions, an evaluation unit that evaluates color image signals in the predetermined directions subjected to the interpolation process by the direction-by-direction interpolation unit, and a generation unit that generates a color image signal to be outputted as an interpolation process result based on a result of the evaluation by the evaluation unit, wherein the evaluation unit evaluates the color image signals in the predetermined directions subjected to the interpolation process with respect to homogeneity and signal intensity.

Accordingly, in a second aspect of the present invention, there is provided an image processing apparatus comprising an interpolation unit adapted to carry out an interpolation process in which, with respect to a color mosaic image signal related to each pixel generated by photoelectrical conversion of an optical image reflecting a subject image, signals of missing colors in the each pixel are interpolated using image signals related to pixels in predetermined directions around the each pixel, wherein the interpolation unit comprises a direction-by-direction interpolation unit that carries out the interpolation process in each of a plurality of predetermined directions, an evaluation unit that evaluates color image signals in the predetermined directions subjected to the interpolation process by the direction-by-direction interpolation unit, and a generation unit that generates a color image signal to be outputted as an interpolation process result based on a result of the evaluation by the evaluation unit, wherein before carrying out the interpolation process on the color mosaic image signal related to the each pixel generated by the photoelectrical conversion, the interpolation unit carries out a predetermined preliminary process on the color mosaic image signal, and the evaluation unit evaluates the color image signals in the respective predetermined directions subjected to the preliminary process and the interpolation process with respect to homogeneity and signal intensity.

Accordingly, in a third aspect of the present invention, there is provided a control method for an image processing apparatus, comprising an interpolation step of carrying out an interpolation process in which, with respect to a color mosaic image signal related to each pixel generated by photoelectrical conversion of an optical image reflecting a subject image, signals of missing colors in the each pixel are interpolated using image signals related to pixels in predetermined directions around the each pixel, wherein the interpolation step comprises a direction-by-direction interpolation step of carrying out the interpolation process in each of a plurality of predetermined directions, an evaluation step of evaluating color image signals in the predetermined directions subjected to the interpolation process in the direction-by-direction interpolation step, and a generation step of generating a color image signal to be outputted as an interpolation process result based on a result of the evaluation in the evaluation step, wherein in the evaluation step, the color image signals in the predetermined directions subjected to the interpolation process are evaluated with respect to homogeneity and signal intensity.

Accordingly, in a fourth aspect of the present invention, there is provided a control method for an image processing apparatus, comprising an interpolation step of carrying out an interpolation process in which, with respect to a color mosaic image signal related to each pixel generated by photoelectrical conversion of an optical image reflecting a subject image, signals of missing colors in the each pixel are interpolated using image signals related to pixels in predetermined directions around the each pixel, wherein the interpolation step comprises a direction-by-direction interpolation step of carrying out the interpolation process in each of a plurality of predetermined directions, an evaluation step of evaluating color image signals in the predetermined directions subjected to the interpolation process in the direction-by-direction interpolation step, and a generation unit step of generating a color image signal to be outputted as an interpolation process result based on a result of the evaluation in the evaluation step, wherein in the interpolation step, a predetermined preliminary process is carried out on the color mosaic image signal before the interpolation process is carried out on the color mosaic image signal related to the each pixel generated by the photoelectrical conversion, and in the evaluation step, the color image signals in the respective predetermined directions subjected to the preliminary process and the interpolation process are evaluated with respect to homogeneity and signal intensity.

Accordingly, in a fifth aspect of the present invention, there is provided a storage medium storing a program for causing a computer to execute a control method for an image processing apparatus.

Accordingly, in a sixth aspect of the present invention, there is provided a storage medium storing a program for causing a computer to execute a control method for an image processing apparatus.

According to the present invention, in the demosaicing process on a color mosaic image signal, homogeneity is used as evaluation criteria information for selecting a direction of a better interpolation result from interpolation results obtained by direction-by-direction interpolation.

For this reason, according to the present invention, an interpolation result (interpolating direction) crossing an edge of a subject is not selected, but a highly correlated interpolating direction, that is, an interpolating direction along an edge of a subject is selected.

Moreover, because evaluation is carried out with consideration given to signal intensity as well as homogeneity, a direction in which homogeneity is high but that is undesirable, for example, a direction in which a false color including low-frequency components exists can be prevented from being selected.

Further features of the present invention will become apparent from the following description of exemplary embodiments (with reference to the attached drawings).

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram schematically showing an arrangement of an image pickup apparatus according to first and second embodiments of the present invention.

FIG. 2 is a block diagram schematically showing an arrangement of a demosaicing unit of the image pickup apparatus according to the first embodiment of the present invention.

FIG. 3 is a block diagram schematically showing an arrangement of a V-direction interpolation unit and an H-direction interpolation unit (direction-by-direction interpolation units) of the demosaicing unit shown in FIG. 2.

FIG. 4 is a block diagram schematically showing a pixel arrangement of a Bayer pattern useful in explaining a direction-by-direction interpolation process.

FIG. 5 is a flowchart showing an evaluation value calculating process for a demosaicing process according to the first embodiment of the present invention.

FIG. 6 is a view showing a 3-by 3-pixel region useful in explaining the evaluation value calculating process for the demosaicing process according to the first embodiment of the present invention.

FIGS. 7A and 7B are views showing filter coefficients of an LPF used in calculating evaluation values for the demosaicing process.

FIG. 8 is a flowchart showing a direction-selection/image-generation process in the demosaicing process.

FIG. 9 is a block diagram schematically showing an arrangement of a demosaicing unit according to the second embodiment of the present invention.

FIG. 10 is a flowchart showing an evaluation value calculating process for a demosaicing process according to the second embodiment of the present invention.

FIGS. 11A and 11B are views showing a 3-by 3-pixel region useful in explaining the evaluation value calculating process for the demosaicing process according to the second embodiment of the present invention.

FIG. 12 is a conceptual diagram useful in explaining a dispersion degree as an evaluation value for the demosaicing process according to the second embodiment of the present invention.

FIG. 13 is a block diagram schematically showing an arrangement of an image pickup apparatus according to a third embodiment of the present invention.

FIG. 14 is a block diagram schematically showing an arrangement of a preliminary processing unit for a demosaicing process according to the third embodiment of the present invention.

FIG. 15 is a conceptual diagram useful in explaining a principle on which chromatic aberration of magnification occurs.

FIG. 16 is a conceptual diagram useful in explaining a principle on which axial chromatic aberration occurs.

FIG. 17 is a block diagram schematically showing an arrangement of an image pickup apparatus according to a fourth embodiment of the present invention.

FIGS. 18A and 18B are diagrams useful in explaining a demosaicing process carried out by the image pickup apparatus according to the fourth embodiment of the present invention.

FIG. 19 is a diagram schematically showing a pixel arrangement of a Bayer pattern.

DESCRIPTION OF THE EMBODIMENTS

The present invention will now be described in detail with reference to the drawings showing embodiments thereof.

FIG. 1 is a block diagram schematically showing an arrangement of an image processing apparatus according to a first embodiment of the present invention. The image processing apparatus according to the present embodiment has a function of effectively reducing false colors in Bayer image data taken by a color image pickup device 102.

Specifically, an optical image (subject image) reflecting a subject forms an image on the color image pickup device 102 via a taking lens 101, and is photoelectrically converted.

The color image pickup device 102 is configured as a single-chip color image pickup device having common primary-color filters. The primary-color filters are comprised of color filters of three primary colors R (red), G (green), and B (blue) having transmission dominant wavelength bands close to 650 nm, 550 nm, and 450 nm, respectively, and generates color planes corresponding to the respective bands of the three primary colors.

In the single-chip color image pickup device, these color filters are spatially arrayed on a pixel-by-pixel basis as shown in FIG. 19, and in each pixel, only light intensity in each single color plane can be obtained. Thus, a color mosaic image signal, that is, an image signal in which two colors among the three primary colors are missing in each pixel is outputted from the color image pickup device 102. An A/D conversion unit 103 converts the color mosaic image signal outputted as an analog voltage from the color image pickup device 102 into color digital image data.

A white balance unit 104 carries out a white balance process. Specifically, the white balance unit 104 multiplies the colors R, G, and B by gains so that the colors R, G, and B in an area that should be white can be isochromatic. By carrying out the white balance process prior to a demosaicing process, a higher saturation than the saturation of a false color can be prevented from being obtained by calculation due to color cast or the like when saturation is calculated by a demosaicing unit 105.

The demosaicing unit 105 interpolates color mosaic image data of missing two colors among the three primary colors in each pixel, thus generating a color image with color image data of full colors R, G, and B being present in all the pixels.

The color image data of each pixel is subjected to a matrix conversion process by a matrix conversion unit 106, and a gamma correction process by a gamma conversion unit 107. As a result, basic color image data is generated.

Then, a color adjustment unit 108 carries out various kinds of processes on the basic color image data so as to make an image look better. For example, the color adjustment unit 108 carries out various kinds of color adjustment processes such as noise reduction, saturation enhancement, hue correction, and edge enhancement. A compression unit 109 compresses the adjusted color image data using JPEG or the like to reduce the recording data size.

The processes carried out by the above devices from the color image pickup device 102 to the compression unit 109 are controlled by a control unit 111 via a bus 113. In providing the control, the control unit 111 uses a memory 112 as a need arises. The digital image data compressed by the compression unit 109 is recorded in a recording medium such as a flash memory by a recording unit 110 under the control of the control unit 111.

Next, a description will be given of the demosaicing process carried out by the demosaicing unit 105. The demosaicing unit 105 carries out interpolation in predetermined directions on a target pixel using its neighboring pixels first, and then selects a direction, thus generating a color image signal of the three primary colors R, G, and B as an interpolation process result for each pixel.

Specifically, a V-direction interpolation unit 202 and an H-direction interpolation unit 203 interpolate image data of missing colors in a V (vertical) direction and an H (horizontal) direction, respectively, to Bayer image data 201 of each pixel inputted to the demosaicing unit 105, and as a result, R, G and B image data in the V direction and the H direction is generated for each pixel.

Next, regarding the R, G and B image data of each pixel after the interpolation process in the vertical direction and the horizontal direction, a homogeneity calculation unit 204 and a homogeneity calculation unit 206 calculate homogeneity with respect to each pixel, and an intensity calculation unit 205 and an intensity calculation unit 206 calculate signal intensity with respect to each pixel.

Then, an evaluation value calculation unit 208 calculates final evaluation values separately in the vertical direction and the horizontal direction with respect to each pixel with consideration given to both homogeneity and signal intensity. A direction-selection/image-formation unit 209 compares the final evaluation value in the vertical direction and the final evaluation value in the horizontal direction with each other, and selects the vertical direction or the horizontal direction in which the evaluation value is greater. Then, the direction-selection/image-formation unit 209 generates final interpolation image data based on the R, G and B image data after the interpolation process in the selected direction, and outputs the final interpolation image data as post-interpolation RGB image data 210, that is, demosaiced data.

Referring next to FIG. 3, a description will be given of the direction-by-direction interpolation process carried out by the V-direction interpolation unit 202 and the H-direction interpolation unit 203. As shown in FIG. 3, the V-direction interpolation unit 202 has a V-direction G interpolation unit 202 a and a V-direction RB interpolation unit 202 b, and the H-direction interpolation unit 203 has an H-direction G interpolation unit 203 a and an H-direction RB interpolation unit 203 b.

In the V-direction interpolation unit 202, the V-direction G interpolation unit 202 a interpolates a G signal (data) of a high frequency band first, and then the V-direction RB interpolation unit 202 b interpolates R and B data. Likewise, in the H-direction interpolation unit 203, the H-direction G interpolation unit 203 a interpolates G data of a high frequency band first, and then the H-direction RB interpolation unit 203 b interpolates R and B data.

Referring next to FIG. 4, a concrete description will be given of the interpolation method. In a case where a G color is to be interpolated, when a target pixel is a pixel related to a G-color filter, G data of the pixel is outputted as it is (mathematical formula 1). In a case where a G color is to be interpolated for a pixel related to an R-color filter and a pixel related to a B-color filter, interpolation data is calculated using a mathematical formula 2 for the V direction and using a mathematical formula 3 for the H direction. It should be noted that G33, G43, and G44 in the mathematical formulas 1, 2, and 3 correspond to pixel symbols shown for the convenience of explanation in FIG. 4.

$\begin{matrix} \left\{ \begin{matrix} {{G\; 34} = {G\; 34}} \\ {{G\; 43} = {G\; 43}} \end{matrix} \right. & \left\lbrack {{Mathematical}\mspace{14mu} {formula}\mspace{14mu} 1} \right\rbrack \\ \left\{ \begin{matrix} {{G\; 33} = \frac{\begin{pmatrix} {{{- R}\; 13} + {{2 \cdot G}\; 23} + {2 \cdot}} \\ {{R\; 33} + {{2 \cdot G}\; 43} - {R\; 53}} \end{pmatrix}}{4}} \\ {{G\; 44} = \frac{\begin{pmatrix} {{{- B}\; 24} + {{2 \cdot G}\; 34} + {2 \cdot}} \\ {{R\; 33} + {{2 \cdot G}\; 43} - {R\; 53}} \end{pmatrix}}{4}} \end{matrix} \right. & \left\lbrack {{Mathematical}\mspace{14mu} {formula}\mspace{14mu} 2} \right\rbrack \\ \left\{ \begin{matrix} {{G\; 33} = \frac{\begin{pmatrix} {{{- R}\; 31} + {{2 \cdot G}\; 32} + {2 \cdot}} \\ {{R\; 33} + {{2 \cdot G}\; 34} - {R\; 35}} \end{pmatrix}}{4}} \\ {{G\; 44} = \frac{\begin{pmatrix} {{{- B}\; 42} + {{2 \cdot G}\; 43} + {2 \cdot}} \\ {{B\; 44} + {{2 \cdot G}\; 45} - {B\; 36}} \end{pmatrix}}{4}} \end{matrix} \right. & \left\lbrack {{Mathematical}\mspace{14mu} {formula}\mspace{14mu} 3} \right\rbrack \end{matrix}$

In a case where an R color is to be interpolated, when a target pixel is a pixel related to an R color filter, R data of the pixel is outputted as it is (mathematical formula 4). In a case where an R color is to be interpolated for a pixel related to a G-color filter, interpolation data is calculated using a mathematical formula 5. In a case where an R color is to be interpolated for a pixel related to a B-color filter, interpolation data is calculated using a mathematical formula 6. For the interpolation of an R color, the same Mathematical formula is used in the V direction and the H direction.

A B color is interpolated in a manner similar to that in the interpolation of an R color. Specifically, a mathematical formula in which R in the mathematical formulas 4 to 6 is replaced with B is used.

{R33=R33  [Mathematical formula 4]

$\begin{matrix} \left\{ \begin{matrix} {{R\; 34} = {\frac{\left( {\left( {{R\; 33} - {G\; 33}} \right) + \left( {{R\; 35} - {G\; 35}} \right)} \right)}{2} + {G\; 34}}} \\ {{R\; 43} = {\frac{\left( {\left( {{R\; 33} - {G\; 33}} \right) + \left( {{R\; 53} - {G\; 53}} \right)} \right)}{2} + {G\; 43}}} \end{matrix} \right. & \left\lbrack {{Mathematical}\mspace{14mu} {formula}\mspace{14mu} 5} \right\rbrack \end{matrix}$ {R44=((R33−G33)+(R35−G35)+(R53−G53)+(R55−G55)/4+G44  [Mathematical formula 6]

Referring next to a flowchart of FIG. 5, a description will be given of an evaluation value calculation process.

The evaluation value calculation unit 208 in FIG. 2 converts V-direction RGB image data 202 c in FIG. 3 obtained by interpolating missing colors in each pixel into color signals (values) of a uniform color space so that homogeneity and signal intensity can be easily calculated (S501). In the present embodiment, a L*a*b* color space using three-dimensional orthogonal coordinates is used as the uniform color space.

In converting the V-direction RGB image data 202 c into L*a*b* values, first, the evaluation value calculation unit 208 converts the V-direction RGB image data 202 c into values of an XYZ color system, which are tristimulus values of an object using mathematical formulas 7 to 9 below. To that end, an RGB color space must be set to be a certain type of RGB color space, and in the present embodiment, it is assumed that an RGB color space is set to be an sRGB color space, and a white color point is set at D65.

R′ _(sRGB) =R′ _(8bit)÷255

G′ _(sRGB) =G′ _(8bit)÷255

B′ _(sRGB) =B′ _(8bit)÷255  [Mathematical formula 7]

R′ _(sRGB) ,G′ _(sRGB) ,B′ _(SRGB)≦0.04045

R _(sRGB) =R′ _(sRGB)÷12.92

G _(sRGB) =G′ _(sRGB)÷12.92

B _(sRGB) =B′ _(sRGB)÷12.92

R′ _(sRGB) ,G′ _(sRGB) ,B′ _(sRGB)>0.04045

R _(sRGB)=[(R′ _(sRGB)+0.055)/1.055]^(2.4)

G _(sRGB)=[(G′ _(sRGB)+0.055)/1.055]^(2.4)

B _(sRGB)=[(B′ _(sRGB)+0.055)/1.055]^(2.4)  [Mathematical formula 8]

$\begin{matrix} {\begin{bmatrix} X_{D\; 65} \\ Y_{D\; 65} \\ Z_{D\; 65} \end{bmatrix} = {\begin{bmatrix} 0.4124 & 0.3576 & 0.1805 \\ 0.2126 & 0.7152 & 0.0702 \\ 0.0193 & 0.1192 & 0.9505 \end{bmatrix}\begin{bmatrix} R_{sRGB} \\ G_{sRGB} \\ B_{sRGB} \end{bmatrix}}} & \left\lbrack {{Mathematical}\mspace{14mu} {formula}\mspace{14mu} 9} \right\rbrack \end{matrix}$

Next, the evaluation value calculation unit 208 converts the tristimulus values of the object (the values of the XYZ color system) into L*a*b* values using the following mathematical formula 10.

L*=116(Y/Y _(n))^(1/3)−16

a*=500{(Y/Y _(n))^(1/3)−(Y/Y _(n))^(1/3)}

b*=200{(Y/Y _(n))^(1/3)−(Z/Z _(n))^(1/3)}  [Mathematical formula 10]

Here, Xn, Yn, and Zn are tristimulus values of a perfect reflecting diffuser, and it is stipulated that Yn=100. Also, an L* value (luminance value), an a* value (green-red chromaticity value), and a b* value (blue-yellow chromaticity value) are limited in terms of values X, Y, and Z that can be applied thereto. Actually, however, there exist colors other than predetermined colors, and in this case, the evaluation value calculation unit 208 obtains L*a*b* values using the following correction formula (mathematical formula 11).

[Mathematical Formula 11]

It should be noted that the function f in the mathematical formula 11 is expressed by the following mathematical formula 12.

ƒ(X/X _(n))=(X/X _(n))^(1/3) X/X _(n)>0.008856

ƒ(X/X _(n))=7.787(X/X _(n))+16/116 X/X _(n)≦0.008856

The function f (Y/Yn) and the function f (Z/Zn) are also expressed similarly to the function f (X/Xn) in the mathematical formula 12.

Next, the evaluation value calculation unit 208 calculates homogeneity (S502). In the present embodiment, the dispersion degree is used as a measure of homogeneity. The dispersion degree is calculated using 3-by 3-pixels centering on a target pixel (v22) as shown in FIG. 6. Although in the present embodiment, 3-by 3-pixels are used, 5-by 5-pixels, 7-by 7-pixels or the like may be used. Also, a color-difference dispersion parameter calculated by the following mathematical formula 13 is used as a dispersion parameter.

ΔE _(ab)=√{square root over ((L ₁ −L ₂)²+(a ₁ −a ₂)²+(b ₁ −b ₂)²)}{square root over ((L ₁ −L ₂)²+(a ₁ −a ₂)²+(b ₁ −b ₂)²)}{square root over ((L ₁ −L ₂)²+(a ₁ −a ₂)²+(b ₁ −b ₂)²)}[Mathematical formula 13]

Although in the present embodiment, ΔEab is used as the color-difference dispersion parameter, ΔE94, ΔE2000, or the like may be used. Concrete methods of calculating ΔE94 and ΔE2000 are well known, and therefore, description thereof is omitted here.

When the color-difference dispersion parameter calculated using the mathematical formula 13 is used, the dispersion degree σ_(v22) ² is calculated using the following mathematical formula 14.

$\begin{matrix} {\sigma_{v\; 22}^{2} = {\frac{1}{n - 1}{\sum\limits_{i = 1}^{n}\left( {\overset{\_}{\Delta \; E_{ab}} - {\Delta \; E_{{ab}_{i}}}} \right)^{2}}}} & \left\lbrack {{Mathematical}\mspace{14mu} {formula}\mspace{14mu} 14} \right\rbrack \end{matrix}$

It should be noted that i in the mathematical formula 14 represents pixel values of pixels v11 to v33 shown in FIGS. 6, and n=9 (3×3=9 pixels).

Next, the evaluation value calculation unit 208 calculates signal intensity (S503). In the present embodiment, saturation is used as a measure of signal intensity. As is the case with the dispersion degree, saturation is calculated using the 3-by 3-pixels centering on the target pixel. A saturation calculation mathematical formula is expressed by the following mathematical formula 15.

C=√{square root over ((a ₁ −a ₂)²+(b ₁ −b ₂)²)}{square root over ((a ₁ −a ₂)²+(b ₁ −b ₂)²)}  [Mathematical formula 15]

Thus, an evaluation value based on the saturation in the pixel v22 is an average of total nine pixels consisting of the target pixel and the neighboring eight pixels, and is expressed by the following mathematical formula 16.

$\begin{matrix} {C_{v\; 22} = {\frac{1}{n}{\sum\limits_{i = 1}^{n}\left( C_{i} \right)}}} & \left\lbrack {{Mathematical}\mspace{14mu} {formula}\mspace{14mu} 16} \right\rbrack \end{matrix}$

The evaluation value calculation unit 208 carries out the processes in the steps S501 to S503 described above with respect to all the pixels of a V image (V-direction RGB data 202 c in FIG. 3). Also, the evaluation value calculation unit 208 carries out processes similar to the processes in the steps S501 to S503 described above with respect to all the pixels of an H image (H-direction RGB data 203 c in FIG. 3) (S504 to S506).

Upon completing the above processes, the evaluation value calculation unit 208 calculates final evaluation values (S507). In calculating the final evaluation values, first, the evaluation value calculation unit 208 calculates evaluation values based on the degrees of dispersion using the following mathematical formula 17.

$\begin{matrix} {{{C\; {var}_{h}} = \frac{\sigma_{h}^{2}}{\sigma_{h}^{2} + \sigma_{v}^{2}}}{{C\; {var}_{v}} = \frac{\sigma_{v}^{2}}{\sigma_{h}^{2} + \sigma_{v}^{2}}}} & \left\lbrack {{Mathematical}\mspace{14mu} {formula}\mspace{14mu} 17} \right\rbrack \end{matrix}$

Here, Cvar_(h) and Cvar_(v) represent evaluation values based on the degrees of dispersion. Next, the evaluation value calculation unit 208 calculates evaluation values based on saturations using the following mathematical formula 18.

$\begin{matrix} {{{Cchroma}_{h} = \frac{{chroma}_{h}}{{chroma}_{h} + {chroma}_{v}}}{{Cchroma}_{v} = \frac{{chroma}_{v}}{{chroma}_{h} + {chroma}_{v}}}} & \left\lbrack {{Mathematical}\mspace{14mu} {formula}\mspace{14mu} 18} \right\rbrack \end{matrix}$

Here, Cchroma_(h) and Cchroma_(v) represent evaluation values based on saturations. Next, the evaluation value calculation unit 208 calculates final evaluation values C_(h) and C_(v) based on saturations using the following mathematical formula 19.

C _(h) =α·Cvar_(h)+(α−1)·Cchroma_(h)

C _(v) =α·Cvar_(v)+(α−1)·Cchroma_(v)  [Mathematical formula 19]

Here, α is a weighting coefficient, which determines how the dispersion degree and the saturation are balanced in consideration. In the present embodiment, it is assumed that α=0.5.

As a result of the above processes, the evaluation value C_(h) or C_(v) is calculated with respect to each pixel, and accordingly, a two-dimensional plane of evaluation values is generated (S507).

Incidentally, final interpolation values are determined by evaluation values, and hence when evaluation values of neighboring pixels vary greatly, this may result in degradation of image quality such as tone jump.

Thus, the evaluation value calculation unit 208 makes the generated evaluation value plane pass through a low-pass filter (hereinafter referred to as the “LPF”) (S508). Regarding a filter coefficient of the LPF, either a filter length of three pixels [1, 2, 1] or a filter length of five pixels [1, 4, 6, 4, 1] may be used, and in either case, it is preferred that the evaluation value plane is filtered both vertically and horizontally.

When the evaluation values are thus calculated by the evaluation value calculation unit 208, the direction-selection/image-formation unit 209 selects one of the vertical and horizontal directions based on the evaluation values, and carries out the above filtering process on interpolation data in the selected direction. As a result, the direction-selection/image-formation unit 209 generates final RGB interpolation image data in which R, G, and B color components exist in all the pixels, and outputs the same as post-interpolation RGB image data 210 (demosaiced data).

Referring next to FIG. 8, a concrete description will be given of a direction-selection and interpolation image-generation method.

With respect to each pixel, the direction-selection/image-formation unit 209 compares the evaluation value C_(h) related to the interpolation in the H direction and the evaluation value C_(v) related to the interpolation in the V direction with each other, and determines whether or not the evaluation value C_(h)<the evaluation value C_(v) (S801). When, as a result, the evaluation value C_(h)<the evaluation value C_(v), the direction-selection/image-formation unit 209 selects R, G, B interpolation data related to the interpolation in the H direction, carries out the above filtering process on the R, G, B interpolation data, and outputs the same as post-interpolation RGB image data 210 (S802).

On the other hand, when the evaluation value C_(h)≧the evaluation value C_(v), the direction-selection/image-formation unit 209 selects R, G, B interpolation data related to the interpolation in the V direction, carries out the above filtering process on the R, G, B interpolation data, and outputs the same as post-interpolation RGB image data 210 (S803)

As described above, in the first embodiment, the degree of color difference dispersion is used as homogeneity as a parameter for calculating evaluation values for selecting a direction to be actually used (interpolation result) from interpolation results obtained by direction-by-direction interpolation. For this reason, an interpolation result in such a direction as to cross an edge of a subject is not selected, but an interpolation result in a highly correlated direction, that is, along an edge of a subject is selected.

Moreover, because saturation as intensity as well as homogeneity is used as a parameter for calculating evaluation values, the possibility that a direction in which homogeneity is good but that is undesirable, for example, a direction in which a false color including low-frequency components exists is selected can be decreased.

In the first embodiment, a direction to be actually used (interpolation result) is adaptively selected from interpolation results obtained by carrying out interpolation in the vertical (V) and horizontal (H) directions separately. On the other hand, in a second embodiment, interpolation is carried out in a plurality of directions, not in one limited direction, and interpolation images in the respective directions are combined according to a ratio of obtained evaluation values (ratio of directions).

A detailed description will now be given of the second embodiment of the present invention.

Arrangements of signal units of an image pickup apparatus according to the second embodiment are substantially the same as those of the first embodiment described with reference to FIG. 1, and therefore, description thereof is omitted, but the second embodiment differs from the first embodiment in an arrangement of the demosaicing unit 105.

FIG. 9 is a block diagram showing in detail the arrangement of the demosaicing unit 105 according to the second embodiment.

In the first embodiment, the two patterns of the H direction and the V direction are prepared for the direction-by-direction interpolation. However, depending on a form of a subject, it may be preferred that interpolation is carried out in directions other than those two directions.

Thus, a basic interpolation unit 211 carries out interpolation in a plurality of directions. In this case, there are some possible interpolation methods, and in the present embodiment, a method described hereafter is used.

As is the case with the V-direction interpolation unit 202 and the H-direction interpolation unit 202, the basic interpolation unit 211 carries out interpolation of R/B after interpolation of G.

Referring to FIG. 4, in interpolation of G, the basic interpolation unit 211 outputs pixel values related to G-color filters as it is as expressed in the mathematical formula 1, and interpolates G values at positions of pixels related to an R-color filter and a B-color filter using the following mathematical formula.

$\begin{matrix} \left\{ \begin{matrix} {{G\; 33} = \frac{\left( {{G\; 23} + {G\; 32} + {G\; 34} + {G\; 43}} \right)}{4}} \\ {{G\; 44} = \frac{\left( {{G\; 34} + {G\; 43} + {G\; 45} + {G\; 54}} \right)}{4}} \end{matrix} \right. & \left\lbrack {{Mathematical}\mspace{14mu} {formula}\mspace{14mu} 20} \right\rbrack \end{matrix}$

The basic interpolation unit 211 interpolates R and B using the mathematical formulas 4 to 6.

Further, in addition to the interpolation in the H direction and the V direction, interpolation is carried out in a plurality of directions, that is, diagonal directions. As a result, natural interpolation results can be obtained for diagonal edges. A DP (diagonal positive) direction of which gradient is positive and a DN (diagonal negative) direction of which gradient is negative are prepared as diagonal directions. A DP-direction interpolation unit 213 and a DN-direction interpolation unit 212 carry out interpolation in the DP direction and the DN direction, respectively.

The G interpolation by the DP-direction interpolation unit 213 and the DN-direction interpolation unit 212 uses G interpolation results obtained by the basic interpolation unit 211. Regarding a method for R interpolation, R interpolation values at R pixel positions are calculated using the mathematical formula 4, and R interpolation values at G pixel positions are calculated using the mathematical formula 5.

R interpolation values at B pixel positions are calculated using the following mathematical formula.

$\begin{matrix} {\left\lbrack {{Mathematical}\mspace{14mu} {formula}\mspace{14mu} 21} \right\rbrack \left\{ \begin{matrix} {{R\; 44P} = {{\left( {{R\; 35} + {R\; 53}} \right)/2} + {\left( {{{- G}\; 35} + {{2 \cdot G}\; 44} - {G\; 53}} \right)/2}}} \\ {{R\; 44N} = {{\left( {{R\; 33} + {R\; 55}} \right)/2} + {\left( {{{- G}\; 33} + {{2 \cdot G}\; 44} - {G\; 55}} \right)/2}}} \end{matrix} \right.} & \; \end{matrix}$

B interpolation at B pixel positions is carried out in a manner similar to that in the R interpolation, and R is replaced with B in the mathematical formulas 4, 5 and 21.

Here, although the present embodiment has been described assuming that the diagonal angle is 0° in the horizontal direction, 45° in the DP direction, and 135° in the DN direction, the present invention is not limited to this, but an arbitrary diagonal angle may be used. For example, diagonal angles may be more finely divided so as to additionally carry out interpolation in a direction of 22.5°.

Post-interpolation RGB images are obtained as a result of the interpolation in the V direction, the H direction, unspecified directions (base), the DP direction, and the DN direction in the above described process. The evaluation value calculation unit 208 calculates evaluation values with respect to these post-interpolation RGB images.

FIG. 10 is a flowchart showing an evaluation value calculating process according to the second embodiment. Although in FIG. 10, there is shown only the evaluation value calculating process for V images, the same evaluation value calculating process as that in FIG. 10 is carried out for images in the H direction, unspecified directions (base), the DP direction, and the DN direction as well.

In the first embodiment, a L*a*b* uniform color space is used to calculate the degree of color difference dispersion as homogeneity. However, a large amount of calculation is required for conversion into L*a*b* values. For this reason, in the second embodiment, homogeneity and intensity are calculated in a G, R-G, B-G color space in which a G signal is used as it is in place of L*, R-G is used in place of a* and b*, and B-G is a color difference signal (S1001 and S1002).

Moreover, in a homogeneity calculating process in the S1001, the dispersion degree is used as a measure of homogeneity as is the case with the first embodiment, but in the homogeneity calculating process in the S1002, the dispersion degree is calculated in a different way than in the first embodiment. In this case, ΔEab is used as a color difference dispersion parameter. On the other hand, in the second embodiment, G, R-G, and B-G are used, the dispersion degree is calculated in relation to these dispersion parameters, and the largest dispersion degree is selected from them.

Moreover, in the first embodiment, the dispersion degree is calculated using a total of nine pixels consisting of a target pixel and its neighboring eight pixels. On the other hand, in the second embodiment, as shown in FIG. 11A, in a case of the H direction, a total of three pixels consisting of a target pixel and its two neighboring pixels in the H direction are used, and the degrees of dispersion σ_(h1) ², σ_(h1) ², σ_(h2) ², and σ_(h3) ² are calculated using h12, h22, and h32 as respective target pixels. Similarly, in the second embodiment, as shown in FIG. 11B, in a case of the V direction, a total of three pixels consisting of a target pixel and its neighboring two pixels in the V direction are used, and the degrees of dispersion σ_(v1) ², σ_(v2) ², and σ_(v3) ² are calculated using v21, v22, and v23 as respective target pixels.

Then, the evaluation value calculation unit 208 obtains the largest dispersion degree among the degrees of dispersion σ_(h1) ², σ_(h2) ², and σ_(h3) ², or σ_(v1) ², σ_(v2) ², and σ_(v3) ² as the dispersion values which are evaluation values (see FIG. 12).

In a case of the DP direction, the dispersion values are obtained using a total of three pixels consisting of a target pixel and its neighboring two pixels on the upper right and lower left of the target pixel, and in a case of the DN direction, the dispersion values are obtained using a total of three pixels consisting of a target pixel and its neighboring two pixels on the upper left and lower right of the target pixel. In a case of unspecified directions, the dispersion values are obtained using a total of nine pixels consisting of a target pixel and its neighboring eight pixels.

Then, the evaluation value calculation unit 208 calculates intensity (S1003). As is the case with the first embodiment, saturation is used as a measure of intensity, but in the second embodiment, intensity is calculated in a different way than in the first embodiment.

Specifically, in the first embodiment, the evaluation value calculation unit 208 obtains the average of saturations of a total of nine pixels consisting of a target pixel and its neighboring eight pixels as an evaluation value of intensity, but in the second embodiment, with respect to the H direction and the V direction, the evaluation value calculation unit 208 obtains the largest value among saturations of the above respective target pixels as an evaluation value of intensity.

The evaluation value calculation unit 208 carries out the processes in the S1001 to the S1003 with respect to all the pixels of images related to the V direction, the H direction, unspecified directions, the DN direction, and the DP direction.

Upon completing the processes in the S1001 to the S1003, the evaluation value calculation unit 208 calculates final evaluation values (S1004). In this case, first, the evaluation value calculation unit 208 calculates evaluation values based on the degrees of dispersion using the following mathematical formula 22.

$\begin{matrix} {{{C\; {var}_{h}} = \frac{\sigma_{h}^{2}}{\sigma_{h}^{2} + \sigma_{v}^{2} + \sigma_{base}^{2} + \sigma_{dn}^{2} + \sigma_{dp}^{2}}}{{C\; {var}_{v}} = \frac{\sigma_{v}^{2}}{\sigma_{h}^{2} + \sigma_{v}^{2} + \sigma_{base}^{2} + \sigma_{dn}^{2} + \sigma_{dp}^{2}}}{{C\; {var}_{base}} = \frac{\sigma_{base}^{2}}{\begin{matrix} {\sigma_{h}^{2} + \sigma_{v}^{2} +} \\ {\sigma_{base}^{2} + \sigma_{dn}^{2} + \sigma_{dp}^{2}} \end{matrix}}}{{C\; {var}_{dn}} = \frac{\sigma_{dn}^{2}}{\begin{matrix} {\sigma_{h}^{2} + \sigma_{v}^{2} +} \\ {\sigma_{base}^{2} + \sigma_{dn}^{2} + \sigma_{dp}^{2}} \end{matrix}}}{{C\; {var}_{dp}} = \frac{\sigma_{dp}^{2}}{\begin{matrix} {\sigma_{h}^{2} + \sigma_{v}^{2} +} \\ {\sigma_{base}^{2} + \sigma_{dn}^{2} + \sigma_{dp}^{2}} \end{matrix}}}} & \left\lbrack {{Mathematical}\mspace{14mu} {formula}\mspace{14mu} 22} \right\rbrack \end{matrix}$

Here, Cvar_(h), Cvar_(v), Cvar_(base), Cvar_(dn), and Cvar_(dp) represent evaluation values based on the degrees of dispersion. Then, the evaluation value calculation unit 208 calculates evaluation values based on saturations using the following mathematical formula 23.

$\begin{matrix} {{{Cchroma}_{h} = \frac{{chroma}_{h}}{\begin{matrix} {{chroma}_{h} + {chroma}_{v} + {chroma}_{base} +} \\ {{chroma}_{dn} + {chroma}_{dp}} \end{matrix}}}{{Cchroma}_{v} = \frac{{chroma}_{v}}{\begin{matrix} {{chroma}_{h} + {chroma}_{v} + {chroma}_{base} +} \\ {{chroma}_{dn} + {chroma}_{dp}} \end{matrix}}}{{Cchroma}_{base} = \frac{{chroma}_{base}}{\begin{matrix} {{chroma}_{h} + {chroma}_{v} + {chroma}_{base} +} \\ {{chroma}_{dn} + {chroma}_{dp}} \end{matrix}}}{{Cchroma}_{dn} = \frac{{chroma}_{dn}}{\begin{matrix} {{chroma}_{h} + {chroma}_{v} + {chroma}_{base} +} \\ {{chroma}_{dn} + {chrome}_{dp}} \end{matrix}}}{{Cchroma}_{dp} = \frac{{chroma}_{dp}}{\begin{matrix} {{chroma}_{h} + {chroma}_{v} + {chroma}_{base} +} \\ {{chroma}_{dn} + {chroma}_{dp}} \end{matrix}}}} & \left\lbrack {{Mathematical}\mspace{14mu} {formula}\mspace{14mu} 23} \right\rbrack \end{matrix}$

Here, Cchroma_(h), Cchroma_(v), Cchroma_(base), Cchroma_(dn), and Cchroma_(dp) represent evaluation values based on saturations. Then, the evaluation value calculation unit 208 calculates final evaluation values C_(h), C_(v), C_(base), C_(cn), and C_(dp) using the following mathematical formula 24.

C _(h) =α·Cvar_(h)+(α−1)·Cchroma_(h)

C _(v) =α·Cvar_(v)+(α−1)·Cchroma_(v)

C _(base) =α·Cvar_(base)+(α−1)·Cchroma_(base)

C _(dn) =α·Cvar_(dn)+(α−1)·Cchroma_(dn)

C _(dp) =α·Cvar_(dp)+(α−1)·Cchroma_(dp)  [Mathematical formula 24]

Here, α is a weighting coefficient, which determines how the dispersion degree and the saturation are balanced in consideration. In the present embodiment, it is assumed that α=0.5.

As a result of the above processes, the evaluation values C_(h), C_(v), C_(base), C_(dh), and C_(dp) are calculated with respect to each pixel, and accordingly, a two-dimensional plane of the evaluation values is generated. Also, as is the case with the first embodiment, the evaluation value calculation unit 208 makes the evaluation value plane pass through the LPF (S1005).

When the evaluation values are thus calculated by the evaluation value calculation unit 208, an image generation unit 220 combines the interpolation images according to the ratio of the evaluation values. The combination ratio is calculated according to the following mathematical formula 25.

$\begin{matrix} {{{Cratio}_{h} = \frac{\frac{1}{c_{h}}}{{\frac{1}{c_{h}} + \frac{1}{c_{v}} + \frac{1}{c_{base}} + \frac{1}{c_{dn}} + \frac{1}{c_{dp}}}\;}}{{Cratio}_{v} = \frac{\frac{1}{c_{v}}}{\frac{1}{c_{h}} + \frac{1}{c_{v}} + \frac{1}{c_{base}} + \frac{1}{c_{dn}} + \frac{1}{c_{dp}}}}{{Cratio}_{base} = \frac{\frac{1}{c_{base}}}{\frac{1}{c_{h}} + \frac{1}{c_{v}} + \frac{1}{c_{base}} + \frac{1}{c_{dn}} + \frac{1}{c_{dp}}}}{{Cratio}_{dn} = \frac{\frac{1}{c_{dn}}}{\frac{1}{c_{h}} + \frac{1}{c_{v}} + \frac{1}{c_{base}} + \frac{1}{c_{dn}} + \frac{1}{c_{dp}}}}{{Cratio}_{dp} = \frac{\frac{1}{c_{dp}}}{\frac{1}{c_{h}} + \frac{1}{c_{v}} + \frac{1}{c_{base}} + \frac{1}{c_{dn}} + \frac{1}{c_{dp}}}}} & \left\lbrack {{Mathematical}\mspace{14mu} {formula}\mspace{14mu} 25} \right\rbrack \end{matrix}$

As a result, final interpolation values are obtained according to the following mathematical formula 26.

       [Mathematical  formula  26] $\left\{ \begin{matrix} {R = {{c_{h} \cdot R_{h}} + {c_{v} \cdot R_{v}} + {c_{base} \cdot R_{base}} + {c_{dn} \cdot R_{dn}} + {c_{dp} \cdot R_{dp}}}} \\ {G = {{c_{h} \cdot G_{h}} + {c_{v} \cdot G_{v}} + {{c_{base} \cdot}G_{base}} + {c_{dn} \cdot G_{dn}} + {c_{dp} \cdot G_{dp}}}} \\ {B = {{c_{h} \cdot B_{h}} + {c_{v} \cdot B_{v}} + {{c_{base} \cdot}B_{base}} + {c_{dn} \cdot B_{dn}} + {c_{dp} \cdot B_{dp}}}} \end{matrix} \right.$

By carrying out the above processes on all the pixels, post-interpolation RGB image data 210 is outputted from the image generation unit 220.

As described above, in the second embodiment, a direction to be actually used (interpolation result) is not adaptively selected from results obtained by direction-by-direction interpolation as in the first embodiment, but final interpolation images are generated according to combination ratios. Thus, in the second embodiment, even when different directions are selected for neighboring pixels, values of the neighboring pixels do not differ greatly, and hence an image that is visually natural can be obtained.

It should be noted that in the generation of interpolation images according to combination ratios as described above, when the percentage of correct directions is not higher as compared with other directions, combination with images in other directions may have an adversary effect. Thus, in the second embodiment, the percentage of correct directions is increased by using the method in which the largest values are selected in the dispersion degree and saturation calculating process as described above.

As shown in FIG. 13, a third embodiment differs from the first and second embodiments in that there is provided a preliminary processing unit 114, and a predetermined preliminary process including a white balance process are carried out before the demosaicing process is carried out by the demosaicing unit 105. The preliminary process is carried out so as to enhance the reliability of the demosaicing unit 105 when it calculates the degrees of dispersion and saturations.

As shown in FIG. 14, the preliminary processing unit 114 has a scratch correction unit 1401 and a magnification chromatic aberration correction unit 1402 as well as the same white-balance unit 104 as that in the first embodiment.

A scratch correction process carried out by the scratch correction unit 1401 is significant in terms of the following. Specifically, the image pickup device 102 may have a scratched defective pixel, which is produced in the manufacturing process or produced due to variations in characteristics of internal analog circuits.

When the image pickup device 102 has a scratched defective pixel, signal charge other than from signal charge corresponding to an actual subject image is accumulated in the scratched defective pixel and outputted as an image signal that looks like a scratch.

When a scratched defective pixel is a target pixel, the reliabilities of the dispersion degree and saturations calculated by the demosaicing unit 105 degrade, and there is concern that incorrect directions are selected.

Thus, the scratch correction unit 1401 of the preliminary processing unit 114 carries out a scratch correction process. As a method for this scratch correction process, a variety of methods may be used such as a method in which a position of a scratched defective pixel is recorded in memory in advance, and when a scratch is to be corrected for, the scratched pixel is replaced with a pixel value related to the nearest pixel in the same color.

The magnification chromatic aberration correction unit 1402 is significant in terms of the following. In a color imaging system, a color that does not exist naturally is produced as blur (chromatic aberration) around a bright area on an image due to chromatic aberration of imaging optical system. The chromatic aberration is broadly divided into lateral chromatic aberration (chromatic aberration of magnification) and longitudinal chromatic aberration (axial chromatic aberration). The chromatic aberration of magnification is a phenomenon in which images are formed at different positions along a focal plane according to wavelengths as shown in FIG. 15. The axial chromatic aberration is a phenomenon in which images are formed at different positions along an optical axis according to wavelengths as shown in FIG. 16.

In general, blurring width of chromatic aberration of magnification is significantly smaller as compared with axial chromatic aberration, and depending on shooting conditions such as aperture value, focal length, and subject distance, extremely thin blurs may appear in different ways according to interpolating directions.

In such a case, there is concern that in the evaluation value calculation process based on saturation by the demosaicing unit 105, chromatic aberration of magnification has an adversary effect. Thus, the magnification chromatic aberration correction unit 1402 carries out a magnification chromatic aberration correction process before the demosaicing process is carried out.

As a method for the magnification chromatic aberration correction process, for example, there are possible methods such as geometric transformation in which planes of respective R, G, and B colors are differently distorted. Regarding the degree of distortion, data for use in correcting for chromatic aberration of magnification according to lens type, aperture value, focal length, subject distance, and so on is recorded in memory in advance, and the data is read out for correcting at the time of preliminary processing. In addition, a variety of methods such as a method in which the departure of R and B planes from a G plane in an image is analyzed and corrected for may be used.

Because as described above, by carrying out the scratch correction process, the white balance process, and the magnification chromatic aberration correction process before the demosaicing process is carried out, the reliabilities of evaluation values calculated by the demosaicing unit 105 can be enhanced, and the accuracy of interpolation can be improved.

As shown in FIG. 17, a fourth embodiment differs from the first and second embodiments in FIG. 1 in that a postprocessing unit 115 is additionally provided in a stage next to the demosaicing unit 105. As shown in FIGS. 18A and 18B, the demosaicing unit 105 has white balance units 104 a to 104 e and magnification chromatic aberration correction units 1402 a to 1402 e associated with the interpolation units 202, 203, and 211 to 213 for the respective directions.

The demosaicing unit 105 according to the fourth embodiment carries out the same white balance process and magnification chromatic aberration correction process as those in the third embodiment as preliminary processes before evaluation values are calculated.

However, with respect to the post-interpolation RGB image data 210 in individual directions inputted to the image generation unit 220, the demosaicing unit 105 according to the fourth embodiment does not carry out the white balance process and the magnification chromatic aberration correction process as the preliminary processes. Namely, in the fourth embodiment, the white balance process and the magnification chromatic aberration correction process on post-interpolation RGB image data 210 in individual directions are carried out by the postprocessing unit 115.

As a result, demosaicing that generally involves a large amount of calculation does not have to be carried out each time, and hence image processing can be speeded up. It should be noted that the scratch correction process is preferably carried out before the demosaicing process is carried out because the scratch correction process has to be carried out only once.

Other Embodiments

Aspects of the present invention can also be realized by a computer of a system or apparatus (or devices such as a CPU or MPU) that reads out and executes a program recorded on a memory device to perform the functions of the above-described embodiment(s), and by a method, the steps of which are performed by a computer of a system or apparatus by, for example, reading out and executing a program recorded on a memory device to perform the functions of the above-described embodiment(s). For this purpose, the program is provided to the computer for example via a network or from a recording medium of various types serving as the memory device (e.g., computer-readable medium).

While the present invention has been described with reference to exemplary embodiments, it is to be understood that the invention is not limited to the disclosed exemplary embodiments. The scope of the following claims is to be accorded the broadest interpretation so as to encompass all such modifications and equivalent structures and functions.

This application claims the benefit of Japanese Patent Application No. 2009-101859 filed Apr. 20, 2009, which is hereby incorporated by reference herein in its entirety. 

What is claimed is:
 1. An image processing apparatus comprising: an interpolation unit adapted to carry out an interpolation process in which, with respect to a color mosaic image signal related to each pixel generated by photoelectrical conversion of an optical image reflecting a subject image, signals of missing colors in the each pixel are interpolated using image signals related to pixels in predetermined directions around the each pixel, wherein said interpolation unit comprises: a direction-by-direction interpolation unit that carries out the interpolation process in each of a plurality of predetermined directions; an evaluation unit that evaluates color image signals in the predetermined directions subjected to the interpolation process by the direction-by-direction interpolation unit; and a generation unit that generates a color image signal to be outputted as an interpolation process result based on a result of the evaluation by the evaluation unit, wherein the evaluation unit evaluates the color image signals in the predetermined directions subjected to the interpolation process with respect to homogeneity and signal intensity, and wherein the evaluation unit evaluates the signal intensity using a G signal, an R-G signal, and a B-G signal.
 2. An image processing apparatus according to claim 1, wherein the evaluation unit evaluates the homogeneity using dispersion degree.
 3. An image processing apparatus according to claim 2, wherein the evaluation unit evaluates the dispersion degree using a G signal, an R-G signal, and a B-G signal.
 4. An image processing apparatus according to claim 1, wherein based on evaluation values of the respective pixels evaluated in the predetermined directions by the evaluation unit, the generation unit calculates a combination ratio of the color image signals in the predetermined directions subjected to the interpolation process, and combines the color image signals in the predetermined directions at the combination ratio, thus generating a color image signal to be outputted as an interpolation process result.
 5. A control method for an image processing apparatus, comprising: an interpolation step of carrying out an interpolation process in which, with respect to a color mosaic image signal related to each pixel generated by photoelectrical conversion of an optical image reflecting a subject image, signals of missing colors in the each pixel are interpolated using image signals related to pixels in predetermined directions around the each pixel, wherein said interpolation step comprises: a direction-by-direction interpolation step of carrying out the interpolation process in each of a plurality of predetermined directions; an evaluation step of evaluating color image signals in the predetermined directions subjected to the interpolation process in the direction-by-direction interpolation step; and a generation step of generating a color image signal to be outputted as an interpolation process result based on a result of the evaluation in the evaluation step, wherein in the evaluation step, the color image signals in the predetermined directions subjected to the interpolation process are evaluated with respect to homogeneity and signal intensity, and wherein in the evaluation step, the signal intensity is evaluated using a G signal, an R-G signal, and a B-G signal.
 6. A storage medium storing a program for causing a computer to execute a control method for an image processing apparatus according to claim
 5. 